package vn.demand.dragon
{
	import mx.formatters.DateFormatter;
	import mx.formatters.NumberBaseRoundType;
	import mx.formatters.NumberFormatter;
	
	public class CommonCommand
	{
		
		public static const LOGIN_SUCCESSFUL:String = 'loginSuccessful';
		
		public static const LOGIN_FAILED:String = 'loginFailed';
		
		public static const CLOSE_TAB:String = 'closeTab';
		
		public static const REQUEST_LOGIN:String = 'requestLogin';
		
		public static const REQUEST_LOGOUT:String = 'requestLogout';
		
		public static const COMPANY_ADDED:String 	= "company_added";
		
		public static const COMPANY_ADD_FAILED:String 	= "company_add_failed";
		
		public static const SUPPLIER_ADDED:String 	= "supplier_added";
		
		public static const SUPPLIER_UPDATED:String 	= "supplier_updated";
		
		public static const SUPPLIER_REMOVED:String 	= "supplier_removed";
		
		public static const SUPPLIER_REMOVE_FAILED:String 	= "supplier_remove_failed";
		
		public static const SUPPLIER_ADD_FAILED:String 	= "supplier_add_failed";
		
		public static const LOAD_SUPPLIERS_SUCCESSFUL:String 	= "loadSupplierSuccesful";
		
		public static const LOAD_SUPPLIERS_FAILED:String 	= "loadSupplierFailed";
		
		public static const OPEN_SUPPLIERS_LIST:String 	= "openSupplierList";
		
		public static const CLOSE_SUPPLIERS_LIST:String 	= "closeSupplierList";
		
		public static const EDIT_SUPPLIER:String 	= "editSupplier";
		
		public static const ADD_SUPPLIER:String 	= "addSupplier";
		
		public static const REMOVE_SUPPLIER:String 	= "removeSupplier";
		
		public static const OPEN_COSTOMERS_LIST:String 	= "openCustomerList";
		
		public static const ADD_CUSTOMER:String 	= "addCustomer";
		
		public static const DELETE_CUSTOMER:String 	= "deleteCustomer";
		
		public static const DELETE_CUSTOMER_SUCCESSFUL:String 	= "deleteCustomerSuccessful";
		
		public static const DELETE_CUSTOMER_FAILED:String 	= "deleteCustomerFailed";

		public static const LOAD_CUSTOMERS_SUCCESSFUL:String 	= "loadCustomerSuccesful";
		
		public static const LOAD_CUSTOMERS_FAILED:String 	= "loadCustomerFailed";
		
		public static const CUSTOMERS_UPDATED_SUCESSFUL:String 	= "customerUpdateSucessful";
		
		public static const CUSTOMERS_UPDATE_FAILED:String 	= "customer_updated";
		
		public static const CUSTOMERS_SELECTED:String 	= "customer_selected";
		
		public static const CLOSE_CUSTOMERS_LIST = "closeCustomerList";;
		
		public static const LOAD_CUSTOMER_DETAIL_SUCCESSFULL:String = "loadCustomerDetailSuccesful";
		
		public static const DELETE_QUOTATION_SUCESSFUL:String = "deleteQuoationSucessfull";
		
		public static const DELETE_QUOTATION_FAILED:String = "deleteQuoationFailed";
		
		public static const SEARCH_QUOTATION_RESET:String = "search_quotation_reset";
		
		public static const DELETE_REFERENCE_SUCESSFUL:String = "deleteReferenceSucessfull";
		
		public static const DELETE_REFERENCE_FAILED:String = "deleteReferenceFailed";
		
		public static const OPEN_PROJECT_TASKS_PANEL:String 	= "open_project_tasks_panel";
		
		public static const OPEN_PROJECT_TASK_LOGS_PANEL:String 	= "open_project_task_logs_panel";
		
		public static const NOTE_TYPE_LOAD_TASK_REFERENCE:String 	= "note_type_load_task_reference";
		
		public static const CLOSE_FINISH_PROJECT_TASKS_PANEL:String 	= "close_finish_project_tasks_PANEL";
		
		public static const CLOSE_FINISH_PROJECT_TASK_LOGS_PANEL:String 	= "close_finish_project_task_logs_PANEL";
		
		public static const BEFORE_LOAD_REFERENCE:String 	= "beforeLoadReference";
		
		public static const OK_FOR_LOAD_REFERENCE:String 	= "okForLoadReference";
		
		public static const CANCEL_FOR_LOAD_REFERENCE:String 	= "cancelForLoadReference";
		
		public static const OPEN_REFERENCES_LIST:String 	= "open_references_list";
		
		public static const CLOSE_REFERENCES_LIST:String 	= "close_references_list";
		
		public static const ON_SEARCH_REFERENCES:String 	= "on_search_references";
		
		public static const PROJECTS_ARCHIVED:String 	= "projects_archived";
		
		public static const PROJECTS_ARCHIVE_FAILED:String 	= "projects_archive_failed";
		
		public static const REFERENCE_SELECTED:String 	= "referenceSelected";
		public static const CLOSE_FINISH_PROJECT_PANEL:String 	= "close_finish_project_panel";
		public static const CLOSE_FINISH_NEW_PROJECT_PANEL:String 	= "close_finish_new_project_panel";
		
		private static var df:DateFormatter = null; 
		private static var nf:NumberFormatter = null; 
		private static var vndNF:NumberFormatter = null; 
		
		public static function get dateFormatter() : DateFormatter {
			if (null == df) {
				df = new DateFormatter();
	        	df.formatString = 'YYYY-MM-DD';
			}
			return df;
		}
		
		public static function get usdNumberFormatter() : NumberFormatter {
			if (null == nf) {
				nf = new NumberFormatter();
	        	nf.precision = 2;
	        	nf.useThousandsSeparator = true;
	        	nf.useNegativeSign = true;
			}
			return nf;
		}
		
		public static function get vndNumberFormatter() : NumberFormatter {
			if (null == vndNF) {
				vndNF = new NumberFormatter();
	        	vndNF.precision = -1;
	        	vndNF.useThousandsSeparator = true;
	        	vndNF.useNegativeSign = true;
	        	vndNF.rounding = NumberBaseRoundType.UP;
			}
			return vndNF;
		}

	}
}
